<?php

namespace app\admin\controller;

use think\App;
use tree\Tree;
use app\admin\model\Access;


class Common extends Base
{
    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->verifyLogin();
    }

    public function getAccessTree(Access $access)
    {
        $list = $access->getMyAccess($this->authId);
        foreach ($list as &$item) {
            $item['checked'] = false;
        }
        $tree = Tree::makeTree($list);

        ajaxSuccess($tree);
    }


    public function authList(Access $access)
    {
        $list = $access->getAuthLists();
        ajaxSuccess($list);
    }
}

